<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

$browser = new bgMLTestFunctional(new sfBrowser());

$browser->
  get('/en/deck_manager/index')->

  with('request')->begin()->
    isParameter('module', 'deck_manager')->
    isParameter('action', 'index')->
  end()->

  isSecure('/en/deck_manager/index')->
  signin(array('username'=>'eux','password'=>'ostia'))->

  get('/en/deck_manager/index')->

  with('response')->begin()->
    isStatusCode(200)->
    checkElement('h1:contains("Your decks")', true)->
    info("1.0 lista dei deck in ordine alfabetico")->
    checkElement('ul[id="deck-list"]', true)->
    checkElement('ul[id="deck-list"] li', 3)->
    checkElement('ul[id="deck-list"] li:nth-child(1)', "bdm")->
    checkElement('ul[id="deck-list"] li:nth-child(2)', "neoc")->
    checkElement('ul[id="deck-list"] li:nth-child(3)', "prototipo")->
    info("1.1 non vede i deck degli altri")->
    checkElement('ul[id="deck-list"] li:contains("mio mazzo")', false)->
  end()
;
